<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>easyui-demo</title>
    <link rel="stylesheet" href="/manager/easyui/themes/default/easyui.css"/>
    <link rel="stylesheet" href="/manager/easyui/themes/icon.css"/>
    <script type="text/javascript" src="/manager/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/manager/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript">
        $(function(){
            //初始化弹出窗
            $("#dg").dialog({
                title:"我是dialog",
                width:700,
                height:500,
                href:"",
                cache:false,
                closed:false,
                modal:false,
                iconCls:"icon-save",
                buttons:[{
                    text:"提交",
                    iconCls:'icon-ok',
                    handler:function(){
                        console.log($('#tree').tree('getChecked'));	// get checked nodes
                        console.log($('#tree').tree('getChecked', 'unchecked'));	// 获取未选择节点
                        console.log($('#tree').tree('getChecked', 'indeterminate'));	// 获取不确定的节点

                    }

                },{
                    text:"关闭",
                    iconCls:'icon-remove',
                    handler:function(){

                        // 查找一个节点并选择它
                        var node = $('#tree').tree('find', 2);
                        $('#tree').tree('check', node.target);
                        // $("#dg").dialog("close");
                    }

                }]
            });

            //初始化下拉框
            $("#dept").combobox({
                url:"/manager/test/getSelectedData",
                textField:"username",
                valueField:"id",
                onLoadSuccess:function(){
                    $("#dept").combobox("select",7);
                }
            });

            //初始化tree控件
            $("#tree").tree({
                url:"/manager/test/getTreeData",
                method:"post",
                animate:false,
                checkbox:true
            });
        });

        function opendg(){
            $("#dg").dialog("open");
        }
        
        function select() {
            //取option value
            alert($("#dept").combobox("getValue"));
            //取option 展示
            alert($("#dept").combobox("getText"));
        }
    </script>
</head>
<body>
    <button type="button" onclick="opendg()">打开</button>
    <button type="button" onclick="select()">取值</button>
   <div id="dg">
        <select id="dept" style="width: 200px;"></select>
       <ul id="tree"></ul>
   </div>
</body>
</html>